/**
 * @author: jpf
 * @area: landingPage.ftl、registerPage.ftl
 */
//登陆页-登陆按钮
function logining(){
    //TODO:jpf-用户性质登陆,暂时只考虑系统管理员登陆，sign="0"
    var obj={
        account:Base64.encode($("#account").val().trim()),
        pwd:Base64.encode($("#password").val().trim()),
        sign:"0"
    }
    $.ajax({
        type:'post',
        url:'/login/loginPost',
        data:JSON.stringify(obj),
        contentType : 'application/json',
        success:function(result){
            if(result.success==true){
                window.location.href="/login/home";
            }else{
                $(".regionInfo>.default>p").css("opacity","1");
            }
        },
        error:function(){
            alert("Ajax失败！");
        }
    });
}
//注册页面-提交注册信息
function registerSubmit(){
    if($('#registerForm').valid()){
        var obj = {
            account:$("#account").val(),
            pwd:$("#password").val(),
            phone:$("#phone").val(),
            email:$("#email").val()
        };
        $.ajax({
            type:'post',
            url:'/login/registerSubmit',
            data:JSON.stringify(obj),
            contentType : 'application/json',
            success:function(result){
                if(result.success==true){
                    alert(result.message);
                    window.location.href="/login/landingPage";
                }else{
                    alert(result.message);
                }
            },
            error:function(){
                alert("Ajax失败！");
            }
        });
    }
}
//传递密码
function passwordPass(id,val){
    document.getElementById(id).value=val;
}
//回车
function _b(){
    if(event.keyCode ==13){
        logining();
    }
}